/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package structures;
import it.unimi.dsi.fastutil.longs.*;
/**
 *
 * @author Gonzalo
 */
public class Set {

    private LongOpenHashSet T;
    private long actual=0;
    private long index=0;
    private long size=0;

    public Set(){
        T=new LongOpenHashSet();
    }

    public Set(int size){
        T=new LongOpenHashSet(size);
    }

    public void add(long u){
        T.add(u);
    }

    public void remove(long u){
        T.remove(u);
    }

    public boolean contains(long n){
        return T.contains(n);
    }

    public long size(){
        return T.size();
    }

    public void init(){
        actual=-1;
        index=0;
        size=T.size();
        next();
    }

    public void initSorter(){
        init();
    }
    

    public boolean notNull(){
        return index<=size;
    }

    public void next(){
        index++;
        if(notNull()){
            actual++;
            while(!T.contains(actual))
                actual++;
        }
    }

    public long getActual(){
        return actual;
    }

}
